# Author:Li
import xadmin

from apps.operations.models import UserAsk, CourseComments, UserCourse, UserFavorite, UserMessage, Banner


class BannerAdmin(object):
    list_display = ["title", "image", "url", "index"]
    # 配置显示字段
    search_fields = ["title", "image", "url", "index"]
    # 配置搜索字段
    list_filter = ["title", "image", "url", "index"]
    # 过滤器


class UserAskAdmin(object):
    list_display = ["name", "mobile", "course_name", "add_time"]
    # 配置显示字段
    search_fields = ["name", "mobile", "course_name"]
    # 配置搜索字段
    list_filter = ["name", "mobile", "course_name", "add_time"]
    # 过滤器


class UserCourseAdmin(object):
    list_display = ["user", "course", "add_time"]
    # 配置显示字段
    search_fields = ["user", "course"]
    # 配置搜索字段
    list_filter = ["user", "course", "add_time"]
    # 过滤器


class UserMessageAdmin(object):
    list_display = ["user", "message", "has_read", "add_time"]
    # 配置显示字段
    search_fields = ["user", "message", "has_read"]
    # 配置搜索字段
    list_filter = ["user", "message", "has_read", "add_time"]
    # 过滤器


class CourseCommentsAdmin(object):
    list_display = ["user", "course", "comments", "add_time"]
    # 配置显示字段
    search_fields = ["user", "course", "comments"]
    # 配置搜索字段
    list_filter = ["user", "course", "comments", "add_time"]
    # 过滤器


class UserFavoriteAdmin(object):
    list_display = ["user", "fav_id", "fav_type", "add_time"]
    # 配置显示字段
    search_fields = ["user", "fav_id", "fav_type"]
    # 配置搜索字段
    list_filter = ["user", "fav_id", "fav_type", "add_time"]
    # 过滤器


xadmin.site.register(UserAsk, UserAskAdmin)
xadmin.site.register(UserMessage, UserMessageAdmin)
xadmin.site.register(UserCourse, UserCourseAdmin)
xadmin.site.register(UserFavorite, UserFavoriteAdmin)
xadmin.site.register(CourseComments, CourseCommentsAdmin)
xadmin.site.register(Banner, BannerAdmin)
